package rules;

import game.Piece;
import gps.api.GPSRule;
import gps.api.GPSState;
import gps.exception.NotAppliableException;

public abstract class Move implements GPSRule{

	protected Piece piece;
	protected int times;
	
	protected abstract GPSState makeMovement(Piece piece, GPSState state);
	
	/*Retorna 1 porque el costo de hacer un solo movimiento o mas de uno es siempre 1*/
	@Override
	public Integer getCost() {
		return 1;
	}
	
	@Override
	public GPSState evalRule(GPSState state) throws NotAppliableException {
		GPSState answer;
		if((answer = makeMovement(this.piece, state)) != null){
				return answer;
		}
		throw new NotAppliableException();
	}
}
